import { createRouter, createWebHistory } from 'vue-router'


const routes = [
  {
    path: '/',
    redirect:'/home',
    component: () => import("@/layout/Layout"),
    children:[
      {
        path: 'home',
        name: '首页',
        component: () => import("@/views/Home"),
      },
      {
        path: 'user',
        name: '用户管理',
        component: () => import("@/views/User"),
      },
      {
        path: 'book',
        name: '书籍管理',
        component: () => import("@/views/Book"),
      },
      { path: 'file', name: '文件管理', component: () => import('../views/File.vue')},
      { path: 'person', name: '个人信息', component: () => import('../views/Person.vue')},
      { path: 'password', name: '密码', component: () => import('../views/Password')},
      { path: 'order', name: '支付订单', component: () => import('../views/Order')},
      { path: 'im', name: '聊天室', component: () => import('../views/Im')},
      { path: 'role', name: '角色管理', component: () => import('../views/Role')},
      { path: 'menu', name: '菜单管理', component: () => import('../views/Menu')},
    ]
  },
  {
    path: '/login',
    name: '登录',
    component: () => import("@/views/Login"),
  },
  {
    path: '/register',
    name: '注册',
    component: () =>import("@/views/Register")
  },
]

const router = createRouter({
  history: createWebHistory(process.env.BASE_URL),
  routes
})

export default router
